package com.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bean.staff;
import com.dao.staffDao;

/**
 * Servlet implementation class modifyStaffMsg
 */
@WebServlet("/modifyStaffMsg.do")
public class modifyStaffMsg extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public modifyStaffMsg() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//response.getWriter().append("Served at: ").append(request.getContextPath());
		String name = request.getParameter("name");
		String personid = request.getParameter("personid");
		String sex = request.getParameter("sex");
		String nation = request.getParameter("nation");
		String face = request.getParameter("face");
		String department = request.getParameter("department");
		String education = request.getParameter("education");
		String contact = request.getParameter("contact");
		String id = request.getParameter("sid");
		
		staff s = new staff();
		s.setPersonid(personid);
		s.setName(name);
		s.setSex(sex);
		s.setNation(nation);
		s.setFace(face);
		s.setDepartment(department);
		s.setEducation(education);
		s.setContact(contact);
		s.setId(Integer.parseInt(id));
		
		staffDao dao = new staffDao();
		dao.modifyStaff(s);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
